[IA64] use is_running_on_xen()
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Tue, 30 May 2006 16:31:19 +0000 (10:31 -0600)
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Tue, 30 May 2006 16:31:19 +0000 (10:31 -0600)
Now xen drivers use is_running_on_xen() to check whether it runs on
xen or bare metal. There remains many if (running_on_xen) in ia64
specific codes. This patch replaces running_on_xen with is_running_on_xen()

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c
linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c
linux-2.6-xen-sparse/arch/ia64/kernel/setup.c
linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c
linux-2.6-xen-sparse/arch/ia64/xen/xenconsole.c
linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h
linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h

index ac49687f1bfaef1dcf7fbbddf4d172bc24a3143c..be09b856e3e62a1b920620cc4e69848ab77a5855 100644 (file)
@@ -171,7 +171,7 @@ static inline void xen_iosapic_write(char __iomem *iosapic, unsigned int reg, u3
 
 static inline unsigned int iosapic_read(char __iomem *iosapic, unsigned int reg)
 {
-       if (!running_on_xen) {
+       if (!is_running_on_xen()) {
                writel(reg, iosapic + IOSAPIC_REG_SELECT);
                return readl(iosapic + IOSAPIC_WINDOW);
        } else
@@ -180,7 +180,7 @@ static inline unsigned int iosapic_read(char __iomem *iosapic, unsigned int reg)
 
 static inline void iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
 {
-       if (!running_on_xen) {
+       if (!is_running_on_xen()) {
                writel(reg, iosapic + IOSAPIC_REG_SELECT);
                writel(val, iosapic + IOSAPIC_WINDOW);
        } else
@@ -1015,7 +1015,7 @@ iosapic_system_init (int system_pcat_compat)
 
        pcat_compat = system_pcat_compat;
 #ifdef CONFIG_XEN
-       if (running_on_xen)
+       if (is_running_on_xen())
                return;
 #endif
        if (pcat_compat) {
index 78ff7a224395275f0fa8163146537603142657a0..a5545035320f1bf98ef7305da28af14146ad8094 100644 (file)
@@ -68,7 +68,7 @@ assign_irq_vector (int irq)
        int pos, vector;
 #ifdef CONFIG_XEN
        extern int xen_assign_irq_vector(int);
-       if (running_on_xen)
+       if (is_running_on_xen())
                return xen_assign_irq_vector(irq);
 #endif /* CONFIG_XEN */
  again:
@@ -382,7 +382,7 @@ register_percpu_irq (ia64_vector vec, struct irqaction *action)
        for (irq = 0; irq < NR_IRQS; ++irq)
                if (irq_to_vector(irq) == vec) {
 #ifdef CONFIG_XEN
-                       if (running_on_xen)
+                       if (is_running_on_xen())
                                return xen_register_percpu_irq(vec, action, 1);
 #endif
                        desc = irq_descp(irq);
@@ -428,7 +428,7 @@ ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect)
        unsigned long phys_cpu_id;
 
 #ifdef CONFIG_XEN
-        if (running_on_xen) {
+        if (is_running_on_xen()) {
                int irq = -1;
 
                /* TODO: we need to call vcpu_up here */
index 030dfb9955ab88974ba0c3e41e57472037913010..16ea104873ae64e8c9067f35b2a658eb61948908 100644 (file)
@@ -248,7 +248,7 @@ reserve_memory (void)
        n++;
 
 #ifdef CONFIG_XEN
-       if (running_on_xen) {
+       if (is_running_on_xen()) {
                rsvd_region[n].start = (unsigned long)__va((HYPERVISOR_shared_info->arch.start_info_pfn << PAGE_SHIFT));
                rsvd_region[n].end   = rsvd_region[n].start + PAGE_SIZE;
                n++;
@@ -411,7 +411,7 @@ setup_arch (char **cmdline_p)
 {
        unw_init();
 #ifdef CONFIG_XEN
-       if (running_on_xen)
+       if (is_running_on_xen())
                setup_xen_features();
 #endif
 
@@ -512,7 +512,7 @@ setup_arch (char **cmdline_p)
 # endif
        }
 #ifdef CONFIG_XEN
-       if (running_on_xen) {
+       if (is_running_on_xen()) {
                extern shared_info_t *HYPERVISOR_shared_info;
                extern int xen_init (void);
 
index 9f2e050c68a19a84e75db908f72f31fe14daac32..ec89e9843ff3141bd58c1538ed93d56ff431b80a 100644 (file)
@@ -672,7 +672,7 @@ privcmd_mmap(struct file * file, struct vm_area_struct * vma)
        struct xen_ia64_privcmd_vma* privcmd_vma = NULL;
        struct resource* res = NULL;
        unsigned long i;
-       BUG_ON(!running_on_xen);
+       BUG_ON(!is_running_on_xen());
 
        BUG_ON(file->private_data != NULL);
 
@@ -737,7 +737,7 @@ direct_remap_pfn_range(struct vm_area_struct *vma,
        unsigned long i;
        unsigned long offset;
        int error = 0;
-       BUG_ON(!running_on_xen);
+       BUG_ON(!is_running_on_xen());
 
 #if 0
        if (prot != vm->vm_page_prot) {
index e7010d96fd1080f4146438491d3cae309fb11ff6..4c6d9eae906b5ada08000c87c080cbe050824a68 100644 (file)
@@ -1,13 +1,13 @@
 #include <linux/config.h>
 #include <linux/console.h>
+#include <asm/hypervisor.h>
 
 int
 early_xen_console_setup (char *cmdline)
 {
 #ifdef CONFIG_XEN
 #ifndef CONFIG_IA64_HP_SIM
-       extern int running_on_xen;
-       if (running_on_xen) {
+       if (is_running_on_xen()) {
                extern struct console hpsim_cons;
                hpsim_cons.flags |= CON_BOOT;
                register_console(&hpsim_cons);
index 79bc9c2b9ec4b46e15a5d733dac5d2320ae19e5b..dc9af4baed65c30a80c6ad2c790b183db78521cc 100644 (file)
@@ -429,7 +429,7 @@ static inline unsigned long
 HYPERVISOR_ioremap(unsigned long ioaddr, unsigned long size)
 {
        unsigned long ret = ioaddr;
-       if (running_on_xen) {
+       if (is_running_on_xen()) {
                ret = __HYPERVISOR_ioremap(ioaddr, size);
                if (unlikely(ret == -ENOSYS))
                        panic("hypercall %s failed with %ld. "
@@ -452,7 +452,7 @@ static inline unsigned long
 HYPERVISOR_phystomach(unsigned long gpfn)
 {
        unsigned long ret = gpfn;
-       if (running_on_xen) {
+       if (is_running_on_xen()) {
                ret = __HYPERVISOR_phystomach(gpfn);
        }
        return ret;
@@ -469,7 +469,7 @@ static inline unsigned long
 HYPERVISOR_machtophys(unsigned long mfn)
 {
        unsigned long ret = mfn;
-       if (running_on_xen) {
+       if (is_running_on_xen()) {
                ret = __HYPERVISOR_machtophys(mfn);
        }
        return ret;
@@ -486,7 +486,7 @@ static inline unsigned long
 HYPERVISOR_zap_physmap(unsigned long gpfn, unsigned int extent_order)
 {
        unsigned long ret = 0;
-       if (running_on_xen) {
+       if (is_running_on_xen()) {
                ret = __HYPERVISOR_zap_physmap(gpfn, extent_order);
        }
        return ret;
@@ -506,8 +506,8 @@ HYPERVISOR_add_physmap(unsigned long gpfn, unsigned long mfn,
                       unsigned long flags, domid_t domid)
 {
        unsigned long ret = 0;
-       BUG_ON(!running_on_xen);//XXX
-       if (running_on_xen) {
+       BUG_ON(!is_running_on_xen());//XXX
+       if (is_running_on_xen()) {
                ret = __HYPERVISOR_add_physmap(gpfn, mfn, flags, domid);
        }
        return ret;
index d70cf36ce953a08eadcbeb43605c17ae76c93b99..cdab2240aa8716e81c25c1947cafe2255cf9730a 100644 (file)
 #include <asm/hypercall.h>
 #include <asm/ptrace.h>
 #include <asm/page.h>
-#include <asm/xen/privop.h> // for running_on_xen
+#include <asm/xen/privop.h> // for is_running_on_xen()
 
 extern shared_info_t *HYPERVISOR_shared_info;
 extern start_info_t *xen_start_info;
 
 void force_evtchn_callback(void);
 
-#define is_running_on_xen() running_on_xen
-
 /* Turn jiffies into Xen system time. XXX Implement me. */
 #define jiffies_to_st(j)       0
 
index 660fef75fbf5494cc627db75e842fd5e832de83a..fbecb9bb763723800c11010bb72c11239c59cf53 100644 (file)
@@ -43,6 +43,7 @@
 
 #ifndef __ASSEMBLY__
 extern int running_on_xen;
+#define is_running_on_xen() running_on_xen
 
 #define        XEN_HYPER_SSM_I         asm("break %0" : : "i" (HYPERPRIVOP_SSM_I))
 #define        XEN_HYPER_GET_IVR       asm("break %0" : : "i" (HYPERPRIVOP_GET_IVR))
@@ -122,7 +123,7 @@ extern void xen_set_eflag(unsigned long);   /* see xen_ia64_setreg */
 
 #define xen_ia64_intrin_local_irq_restore(x)                           \
 {                                                                      \
-     if (running_on_xen) {                                             \
+     if (is_running_on_xen()) {                                                \
        if ((x) & IA64_PSR_I) { xen_ssm_i(); }                          \
        else { xen_rsm_i(); }                                           \
     }                                                                  \
@@ -131,7 +132,7 @@ extern void xen_set_eflag(unsigned long);   /* see xen_ia64_setreg */
 
 #define        xen_get_psr_i()                                                 \
 (                                                                      \
-       (running_on_xen) ?                                              \
+       (is_running_on_xen()) ?                                         \
                (xen_get_virtual_psr_i() ? IA64_PSR_I : 0)              \
                : __ia64_get_psr_i()                                    \
 )
@@ -139,7 +140,7 @@ extern void xen_set_eflag(unsigned long);   /* see xen_ia64_setreg */
 #define xen_ia64_ssm(mask)                                             \
 {                                                                      \
        if ((mask)==IA64_PSR_I) {                                       \
-               if (running_on_xen) { xen_ssm_i(); }                    \
+               if (is_running_on_xen()) { xen_ssm_i(); }                       \
                else { __ia64_ssm(mask); }                              \
        }                                                               \
        else { __ia64_ssm(mask); }                                      \
@@ -148,7 +149,7 @@ extern void xen_set_eflag(unsigned long);   /* see xen_ia64_setreg */
 #define xen_ia64_rsm(mask)                                             \
 {                                                                      \
        if ((mask)==IA64_PSR_I) {                                       \
-               if (running_on_xen) { xen_rsm_i(); }                    \
+               if (is_running_on_xen()) { xen_rsm_i(); }                       \
                else { __ia64_rsm(mask); }                              \
        }                                                               \
        else { __ia64_rsm(mask); }                                      \
@@ -168,9 +169,9 @@ extern void xen_set_rr(unsigned long index, unsigned long val);
 extern unsigned long xen_get_rr(unsigned long index);
 extern void xen_set_kr(unsigned long index, unsigned long val);
 
-/* Note: It may look wrong to test for running_on_xen in each case.
+/* Note: It may look wrong to test for is_running_on_xen() in each case.
  * However regnum is always a constant so, as written, the compiler
- * eliminates the switch statement, whereas running_on_xen must be
+ * eliminates the switch statement, whereas is_running_on_xen() must be
  * tested dynamically. */
 #define xen_ia64_getreg(regnum)                                                \
 ({                                                                     \
@@ -178,17 +179,17 @@ extern void xen_set_kr(unsigned long index, unsigned long val);
                                                                        \
        switch(regnum) {                                                \
        case _IA64_REG_CR_IVR:                                          \
-               ia64_intri_res = (running_on_xen) ?                     \
+               ia64_intri_res = (is_running_on_xen()) ?                        \
                        xen_get_ivr() :                                 \
                        __ia64_getreg(regnum);                          \
                break;                                                  \
        case _IA64_REG_CR_TPR:                                          \
-               ia64_intri_res = (running_on_xen) ?                     \
+               ia64_intri_res = (is_running_on_xen()) ?                        \
                        xen_get_tpr() :                                 \
                        __ia64_getreg(regnum);                          \
                break;                                                  \
        case _IA64_REG_AR_EFLAG:                                        \
-               ia64_intri_res = (running_on_xen) ?                     \
+               ia64_intri_res = (is_running_on_xen()) ?                        \
                        xen_get_eflag() :                               \
                        __ia64_getreg(regnum);                          \
                break;                                                  \
@@ -203,27 +204,27 @@ extern void xen_set_kr(unsigned long index, unsigned long val);
 ({                                                                     \
        switch(regnum) {                                                \
        case _IA64_REG_AR_KR0 ... _IA64_REG_AR_KR7:                     \
-               (running_on_xen) ?                                      \
+               (is_running_on_xen()) ?                                 \
                        xen_set_kr((regnum-_IA64_REG_AR_KR0), val) :    \
                        __ia64_setreg(regnum,val);                      \
                break;                                                  \
        case _IA64_REG_CR_ITM:                                          \
-               (running_on_xen) ?                                      \
+               (is_running_on_xen()) ?                                 \
                        xen_set_itm(val) :                              \
                        __ia64_setreg(regnum,val);                      \
                break;                                                  \
        case _IA64_REG_CR_TPR:                                          \
-               (running_on_xen) ?                                      \
+               (is_running_on_xen()) ?                                 \
                        xen_set_tpr(val) :                              \
                        __ia64_setreg(regnum,val);                      \
                break;                                                  \
        case _IA64_REG_CR_EOI:                                          \
-               (running_on_xen) ?                                      \
+               (is_running_on_xen()) ?                                 \
                        xen_eoi() :                                     \
                        __ia64_setreg(regnum,val);                      \
                break;                                                  \
        case _IA64_REG_AR_EFLAG:                                        \
-               (running_on_xen) ?                                      \
+               (is_running_on_xen()) ?                                 \
                        xen_set_eflag(val) :                            \
                        __ia64_setreg(regnum,val);                      \
                break;                                                  \